package com.shop.action;

import java.awt.Font;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.StandardChartTheme;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

public class JFreechartAction {

	private JFreeChart chart;

	public String execute() {
		DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); 
		//addValue�����������ݣ�ͼ��������ƣ� 
		dataSet.addValue(100, "App", "Apple"); 
		dataSet.addValue(200, "Goo", "Google"); 
		dataSet.addValue(70, "MS", "Microsoft");
		
		StandardChartTheme theme = new StandardChartTheme("mytheme");
		//���ñ������� 
		theme.setExtraLargeFont(new Font("΢���ź�",Font.BOLD,32)); 
		//����ͼ������ 
		theme.setRegularFont(new Font("����",Font.BOLD,14)); 
		//������������ 
		theme.setLargeFont(new Font("����",Font.BOLD,14)); 
		 
		ChartFactory.setChartTheme(theme); 
		
		chart = ChartFactory.createBarChart3D( 
				"�ֻ�ռ����ͼ", //���� 
				"��˾���", //Ŀ¼����� 
				"����", //�������� 
				dataSet, //���Դ 
				PlotOrientation.VERTICAL, //ͼ�?��:ˮƽ,��ֱ 
				true, //�Ƿ���ʾͼ�� 
				false, //�Ƿ���ɹ��� 
				false //�Ƿ����URL���� 
				  ); 
		
		return "success";
	}
	
	public JFreeChart getChart() {
		return chart;
	}
	
	
	
}
